// components/avatar/index.js
Component({
  externalClasses: ['avatar-extra-class', 'user-extra', 'e-nick-name', 'e-time'],
  /**
   * 组件的属性列表
   */
  properties: {
    avatarUrl: String,
    nickName: String,
    contentTime: String,
    custom: {
      type: Boolean,
      value: false
    },
    preview: {
      type: Boolean,
      value: false
    },
    personAvatar: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    onPreview() {
      if (this.properties.preview) {
        let urls = new Array();
        urls.push(this.properties.avatarUrl)
        wx.previewImage({
          current: this.properties.avatarUrl, // 当前显示图片的http链接
          urls: urls // 需要预览的图片http链接列表
        })
      }
    }
  }
})